HAL GPIO migration: List of applicable concepts ¶
This section provides information about the HAL GPIO applicable architecture concepts.
Concepts for GPIO ¶
|
Concept |
Description |
|---|---|
|
HAL GPIO APIs now rely on LL APIs rather than performing direct register access. |
|
|
Define statements and enumerations redirected to LL equivalents |
HAL GPIO define statements and enumerations are based on LL define statements. |
|
All hardware macros have been removed from the HAL GPIO driver, and equivalent services are ensured through the LL APIs. |
|
|
The HAL GPIO functions were updated to return:
|
|
|
All TypeDef parts of the HAL GPIO driver have been removed and replaced by
|
|
|
Const keywords have been added to non-modifiable pointers to ensure that either the pointer itself or the data it points to cannot be modified. This enhances code safety and readability, prevents unintended modifications, and renders code more robust and maintainable. |
|
|
There is no state machine in the HAL GPIO. The parameters are checked using
|
|
|
Merge HAL extension files with common ones and remove the EX prefix from APIs. |
Only one HAL GPIO header file remains and all macros, define statements, and functions from
|
|
Adding HAL_GPIO_WriteMultipleStatePin : write in one shot the BSRR register setting and restting several pins in the same cycle. |
|
|
Update the GPIO init structure and function to move Pins as a standalone parameter of the function. |
The field Pins is no more part of the
|
|
Remove EXTI Intrinsic Management in System HAL Drivers; Let Users Rely on EXTI HAL Driver. |
No more
The GPIO_EXTI callback and the
|
|
Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels. |
Finite parameters (including GPIO instances) have been converted into enumerated types (enums) at HAL level. This improves code readability, maintainability, and type safety. |
|
Add HAL_PPP Prefix to All HAL Peripheral APIs (Defines, Macros, Types, and Functions). |
All HAL GPIO functions start with
|
Other HAL GPIO changes ¶
|
Concept |
Consideration |
|---|---|
|
Add alias defines for peripherals to simplify alternate function identification; these defines are derived from the dedicated AF enumeration |
In HAL1, these defines were available in
|
|
Split mode and output type |
Provide a dedicated parameter for the mode (IN, OUT, AF, ANALOG) and a separate parameter for the output type (push-pull or open-drain). The rationale is to align with the LL, which offers separate APIs for mode and output type, and to allow the user to select the output type independently. |